home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: bcc.ac.uk!slidel
- From: slidel@bsm.bioc.ucl.ac.uk (Timothy Slidel)
- Subject: Re: do || die;
- Message-ID: <1996Mar7.204045.58337@ucl.ac.uk>
- Date: Thu, 7 Mar 1996 20:40:45 GMT
- References: <1996Mar7.052636.59812@ucl.ac.uk> <4hmaf2INNqir@keats.ugrad.cs.ubc.ca>
- Organization: University College London
- X-Newsreader: TIN [version 1.2 PL2]
-
- Kazimir Kylheku (c2a192@ugrad.cs.ubc.ca) wrote:
- : I did. I found out from the C grammar listed in the K&R that a the
- : ``statement'' syntactic unit generates a ``logical-AND-expression ; ''
- : sentential form quite happily. :)
-
- Ok - I saw this bit, but there are lots of things in C that are
- syntactically correct but look awful..
-
- : >issues a warning about an unused value...
- : ...which is somewhat of an indicator that all may not be well, stylistically.
-
- One could always stick a (void) cast before such a statement to discard the
- value, as should/could be done with unused function return values - just to
- be pedantic...
-
- : It might seem confusing at first to someone not accustomed to dealing with
- : Bourne shell scripts or Perl.
-
- Yes, I use Perl quite a bit - which is where I picked up this habit, but I
- hadn't thought of using it in C because you can't do things like:
-
- condition && break;
-
- etc. like you can (I think usefully) in Perl. Which is one reason why I am
- somewhat reluctant to use it. Of course, the short-circuitness of the logical
- operators comes into its own inside if statements - as in the old getchar K&R
- example (p. 41), so why shouldn't we use this feature 'on its own'?
-
- --
- Tim Slidel, Email: t.slidel@biochem.ucl.ac.uk
- BSM Unit, Biochemistry and Molecular Biology, Tel: +44 171419 3896
- University College, Gower Street, Fax: +44 171380 7193
- London WC1E 6BT, United Kingdom.
-
-